
#include <iostream>
#include <memory>
#include "UdpServer.hpp"
#include "Dict.hpp"
void Usage(std::string proc)
{
    std::cout << "Usage:\n\t" << proc << "local_port\n" <<std::endl;
}



using namespace dict_ns;
int main(int argc, char* argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }

    //std::string ip = argv[1];
    uint16_t port = std::stoi(argv[1]);
    Dict dict;
    std::unique_ptr<UdpServer> udp = std::make_unique<UdpServer>(port,std::bind(&Dict::Translate,&dict,std::placeholders::_1,std::placeholders::_2));
    udp->InitServer(); 
    udp->Start();
    
    return 0;
}